﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleUnitity.Cache
{
    public static class ICacheExtensions
    {
        public static object Get(this ICache cache, string key, Func<object> notfoundHandle)
        {
            object result = null;
            result = cache.Get(key);
            if (result == null)
            {
                result = notfoundHandle();
                cache.Set(key, result);
            }
            return result;
        }
    }
}
